#include<iostream>
using namespace std;

// 赋值运算符重载

class Person
{
public:
	Person(int age)
	{
		m_Age = new int (age);
	}

	~Person()  // 手动释放内存
	{
		if (m_Age != NULL)
		{
			delete m_Age;
			m_Age = NULL;
		}
	}

	
	int *m_Age;
};

void test01()
{
	Person p1(18);

	Person p2(20);

	p2 = p1;  // 赋值运算操作


	cout << "p1的年龄为：" << *p1.m_Age << endl;

	cout << "p2的年龄为：" << *p2.m_Age << endl;

}

int main()	//注意一个项目中main函数不能重名
{
	test01();
	return 0;

}